
//#include "rsp.h"

#include "controller.h"
#include "update.h"
#include "coid/comm/binstream/forkstream.h"
#include "coid/comm/binstream/stdstream.h"
#include "coid/comm/binstream/filestream.h"

//#include "s_world.h"

////////////////////////////////////////////////////////////////////////////////
ushort Grsp_version = 3;

////////////////////////////////////////////////////////////////////////////////
MsecTimer           _Timer;

rsp_controller*     Gactive_controller = 0;
uint                Gtouch = 0;

rsp_settings dummy;
rsp_settings&       RSP_SETTINGS = dummy;

////////////////////////////////////////////////////////////////////////////////
binstream* TLOG = 0;
binstream* CLOG = 0;
binstream* BLOG = 0;

int LOG_Level = 2;


////////////////////////////////////////////////////////////////////////////////
void init_server_log()
{
    static txtstream __SLOG;
    static forkstream __SLOG_FORK;
    static stdoutstream __SLOG_O;
    static bofstream __SLOG_F;

    static bofstream __CLOG_F;
    static txtstream __CLOG;

    static bofstream __BLOG;

    __SLOG_F.open(".log");
    __SLOG_O.set_newline_on_flush(false);
    __SLOG_FORK.bind_streams( &__SLOG_F, &__SLOG_O );
    __SLOG.bind( __SLOG_FORK );
    __SLOG.set_newline_on_flush(true);


    __CLOG_F.open(".logcmds");
    __CLOG.bind(__CLOG_F);


    __BLOG.open(".log.bin");

    TLOG = &__SLOG;
    CLOG = &__CLOG;
    BLOG = &__BLOG;
};

////////////////////////////////////////////////////////////////////////////////
void init_client_log( binstream* bin )
{
    static bofstream __CLOG_F;
    static txtstream __CLOG;

    __CLOG_F.open(".logcmdc");
    __CLOG.bind(__CLOG_F);

    TLOG = bin;
    CLOG = &__CLOG;
};

